// components/importCell/importCell.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    disabled: {
      type: Boolean,
      value: false
    },
    bottomLine: {
      type: Boolean,
      value: true
    },
    title: {
      type: String,
      value: ""
    },
    key: {
      type: String,
      value: ""
    },
    placeholder: {
      type: String,
      value: "请输入内容"
    },
    inputType: {
      type: String,
      value: "text"
    },
    inputValue: {
      type: String,
      value: ""
    },
    unit: {
      type: String,
      value: ""
    },
    mustFill: {
      type: Boolean,
      value: true
    },
    maxLength:{
      type:Number,
      value:-1
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    value: "",
  },
  observers: {
    'inputValue': function (newValue) {
      this.setData({
        value: newValue
      })
    }
  },
  lifetimes: {
    attached: function () {
      // 在组件实例进入页面节点树时执行
      if (this.properties.inputValue) {
        this.setData({
          value: this.properties.inputValue
        })
      }


    },
    detached: function () {

    },
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //输入变化绑定:
    cellInputChange(e) {
      // console.log("JJLog:输入变化:" + JSON.stringify(e));
      this.triggerEvent("cellChange", {
        value: e.detail.value,
        key: e.currentTarget.dataset.key
      })
    }
  }
})
